Standard Module string

string This module defines some constants useful for checking character classes, some exceptions, and some useful string functions. The constants are:
\begin{datadesc}{digits}
 The string \code{'0123456789'}.
\end{datadesc}

\begin{datadesc}{hexdigits}
 The string \code{'0123456789abcdefABCDEF'}.
\end{datadesc}

\begin{datadesc}{letters}
 The concatenation of the strings \code{lowercase} and
 \code{uppercase} described below.
\end{datadesc}

\begin{datadesc}{lowercase}
 A string containing all the characters that are con...
...t on the routines \code{upper} and \code{swapcase} is
 undefined.
\end{datadesc}

\begin{datadesc}{octdigits}
 The string \code{'01234567'}.
\end{datadesc}

\begin{datadesc}{uppercase}
 A string containing all the characters that are con...
...t on the routines \code{lower} and \code{swapcase} is
 undefined.
\end{datadesc}

\begin{datadesc}{whitespace}
 A string containing all characters that are consid...
...fect on the routines \code{strip} and \code{split} is
 undefined.
\end{datadesc}
The exceptions are: The functions are:
\begin{funcdesc}{atof}{s}
Convert a string to a floating point number. The strin...
... in Python, optionally
preceded by a sign (\samp{+} or \samp{-}).
\end{funcdesc}

\begin{funcdesc}{atoi}{s}
Convert a string to an integer. The string must consis...
...ore
digits, optionally preceded by a sign (\samp{+} or \samp{-}).
\end{funcdesc}

\begin{funcdesc}{atol}{s}
Convert a string to a long integer. The string must co...
...ore digits, optionally preceded by a sign (\samp{+} or \samp{-}).
\end{funcdesc}

\begin{funcdesc}{expandtabs}{s\, tabsize}
Expand tabs in a string, i.e. replace ...
...n't understand other non-printing characters or escape
sequences.
\end{funcdesc}

\begin{funcdesc}{find}{s\, sub\optional{\, start}}
Return the lowest index in \v...
...ode{0}. If \var{start} is
negative, \code{len(\var{s})} is added.
\end{funcdesc}

\begin{funcdesc}{rfind}{s\, sub\optional{\, start}}
Like \code{find} but finds the highest index.
\end{funcdesc}

\begin{funcdesc}{index}{s\, sub\optional{\, start}}
Like \code{find} but raise \code{ValueError} when the substring is
not found.
\end{funcdesc}

\begin{funcdesc}{rindex}{s\, sub\optional{\, start}}
Like \code{rfind} but raise \code{ValueError} when the substring is
not found.
\end{funcdesc}

\begin{funcdesc}{count}{s\, sub\, i}
Return the number of (non-overlapping) occu...
...at least \var{i}.
If \var{i} is omitted, it defaults to \code{0}.
\end{funcdesc}

\begin{funcdesc}{lower}{s}
Convert letters to lower case.
\end{funcdesc}

\begin{funcdesc}{split}{s}
Returns a list of the whitespace-delimited words of the string
\var{s}.
\end{funcdesc}

\begin{funcdesc}{splitfields}{s\, sep}
 Returns a list containing the fields of ...
...{s}]}, for any string
 \var{s}. (See also \code{regsub.split()}.)
\end{funcdesc}

\begin{funcdesc}{join}{words}
Concatenate a list or tuple of words with intervening spaces.
\end{funcdesc}

\begin{funcdesc}{joinfields}{words\, sep}
Concatenate a list or tuple of words w...
...ring.splitfields(\var{t}, \var{sep}), \var{sep})}
equals \var{t}.
\end{funcdesc}

\begin{funcdesc}{strip}{s}
Removes leading and trailing whitespace from the string
\var{s}.
\end{funcdesc}

\begin{funcdesc}{swapcase}{s}
Converts lower case letters to upper case and vice versa.
\end{funcdesc}

\begin{funcdesc}{upper}{s}
Convert letters to upper case.
\end{funcdesc}

\begin{funcdesc}{ljust}{s\, width}
\funcline{rjust}{s\, width}
\funcline{center}...
... on the right, left or both sides.
The string is never truncated.
\end{funcdesc}

\begin{funcdesc}{zfill}{s\, width}
Pad a numeric string on the left with zero di...
...h is reached. Strings starting with a sign are handled correctly.
\end{funcdesc}